#ifndef __LOG_MODULE_H__
#define __LOG_MODULE_H__

#include "common.h"
#include "global_config.h"

/* Log entry types */
typedef enum {
    LOG_INFO = 0,
    LOG_WARNING,
    LOG_ERROR,
    LOG_ALARM,
    LOG_OPERATION,
    LOG_DEBUG
} log_level_t;

/* Log entry structure */
typedef struct {
    log_level_t level;
    uint32_t timestamp;
    module_id_t module;
    uint16_t event_id;
    char message[64];
    float data_value;
} log_entry_t;

/* Function declarations */
rt_err_t log_module_init(void);
void log_thread_entry(void *parameter);
rt_err_t log_write(log_level_t level, module_id_t module, const char *message, float data_value);
rt_err_t log_read(uint32_t index, log_entry_t *entry);
rt_err_t log_clear(void);
uint32_t log_get_count(void);
rt_err_t log_set_storage_interval(uint32_t interval);

/* External configuration access */
extern log_config_t *log_get_config(void);

#endif /* __LOG_MODULE_H__ */